import { useRoutes } from 'react-router-dom';
import Error from '../pages/Error';
import Home from '../pages/Home';
import Index from '../pages/home/Index';
import Login from '../pages/Login';
import Visitorlist from '../pages/visitor/Visitorlist';
const Routes = () => {
  return useRoutes([
    {
      // 登录
      path: '/',
      element: <Login />,
      title: { title: '访客登录' },
    },
    {
      path: '/login',
      element: <Login />,
      title: { title: '访客登录' },
    },
    {
      // 404
      path: '/*',
      element: <Error />,
      title: { title: '访客404' },
    },
    {
      // 首页
      path: '/home',
      element: <Home />,
      title: { title: '访客系统' },
      // 子路由
      children: [
        // 首页
        {
          path: 'index',
          element: <Index />,
          title: { title: '访客系统' },
        }
      ],
    },
    {
      // 访客记录
      path: '/visitor',
      element: <Home />,
      title: { title: '访客记录' },
      // 子路由
      children: [
        //  访客列表
        {
          path: 'visitorlist',
          element: <Visitorlist />,
          title: { title: '访客列表' },
        },
      ],
    },
  ]);
};
export default Routes;
